import Vue from 'vue'

//引入Vuex状态管理工具插件
import Vuex from 'vuex'
// 2.把引入的插件注册到Vue上

//引入获取三级导航数据请求的对象并解构

import {reqgetBaseCategoryList} from '@/api'

Vue.use(Vuex)

// 3.定义方法

const state = {
  // 定义三级导航的数据
  Level_three_navigation:
    [
    
  ]

}
const actions = {
  //异步请求所以放这
  async  gain_Level_three_navigation({commit}) {
    const three_data = await reqgetBaseCategoryList()
    if (three_data.code === 200) {
    commit('SAVE_Level_three_navigation',three_data.data)
      
    } else {
      console.log('请求错误');
    }
  }
}
const mutations = {
  SAVE_Level_three_navigation(state,data) {
    state.Level_three_navigation=data
  }
}
const getters = {}
// 4.添加仓库实例并导出

export default new Vuex.Store({
  state,
  actions,
  mutations,
  getters
})